﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>独立方法页</title>
    <link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>

    <link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../Style/skin/css/Default.css" rel="stylesheet" />
    <script src="../EnumLab.js"></script>
    <script type="text/javascript">
        $(function () {

            InitBar(MenuModel.Func);
            var html = "";

        });

        function Save() {
            var name = $("#TB_Name").val();
            var id = $("#TB_No").val();

            var func = new Entity("BP.CCBill.Sys.Func");
            var webUser = new WebUser();

            func.Name = name;
            func.FuncID = id;

            if (func.FuncID == "" || func.Name == "") {
                alert("err@名称与编号不能为空.");
                return;
            }
            func.Insert();

            //更新节点表单类型.
            var moduleNo = GetQueryString("ModuleNo");
            var en = new Entity("BP.CCFast.CCMenu.Menu");
            en.ModuleNo = moduleNo;
            en.Name = func.Name;
            en.MenuModel = MenuModel.Func; //独立功能菜单.
            en.Icon = "icon-energy";
            en.Insert();
            en.UrlExt = func.No;
            en.Update();

            
        //var enmethod = new Entity("BP.CCBill.Template.Method");
        //enmethod.MethodID = id;
        //enmethod.Name = name;
        //enmethod.MethodModel = "Func"; 
        //enmethod.RefMethodType = 1;
        //enmethod.Icon = "icon-energy";
        //enmethod.No = func.No;
        //enmethod.Insert();

            alert("创建成功，您可以在在菜单里执行高级编辑与授权.");

            // SetHref( "Default.htm");
            //window.location.href = "../SFTableEditData.htm?FK_SFTable=" + en.No + "&QueryType=Dict";
            SetHref("../../Comm/En.htm?EnName=BP.CCBill.Sys.Func&No=" + func.No);
        }
        function GenerPinYin() {

            //是否是全拼.
            var isQuanPin = 0;
            if (document.getElementById("RB_FuncSrc_0").checked == true)
                isQuanPin = 1;

            // var name = $('#TB_Nam').val();
            var name = document.getElementById("TB_Name").value;
            if (name == "")
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_CCFormDesigner");
            handler.AddPara("IsQuanPin", isQuanPin);
            handler.AddPara("TB_Name", encodeURIComponent(name));
            var data = handler.DoMethodReturnString("NewFrmGuide_GenerPinYin");

            $("#Msg").html("");
            if (data.indexOf('err@') >= 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }
            var webUser = new WebUser();

            $('#TB_No').val(data);
            //  $('#TB_PTable').val(key);
            // $('#TB_No_Org').val(keyOrg);
            //   $('#TB_PTable_Org').val(keyOrg);
            return;
        }

    </script>
</head>
<body>
    <div id="bar">
    </div>
    <fieldset>
        <legend>功能名称 </legend>
        <table>
            <tr>
                <td>名称 </td>
                <td>
                    <input type="text" value="" id="TB_Name" name="TB_Name" placeholder="比如：打卡、清除测试数据、备份数据库" onblur="GenerPinYin()"
                           style="width:90%;" />
                </td>
            </tr>

            <tr>
                <td>来源 </td>
                <td>
                    <input id="RB_FuncSrc_0" type="radio" name="RB_FuncSrc" value="0" checked="true" onclick="GenerPinYin()" /><label for="RB_FuncSrc_0">自定义</label>
                    <input id="RB_FuncSrc_1" type="radio" name="RB_FuncSrc" value="1" /><label for="RB_FuncSrc_1">内置</label>
                </td>
            </tr>


            <tr>
                <td>内置功能名称 </td>
                <td>
                    <input type="text" value="" id="TB_No" style="width:90%;" />
                </td>
            </tr>

            <tr>
                <td> </td>
                <td>
                </td>
            </tr>

        </table>

        <div id="Msg"></div>
        <input type="button" id="Btn_Save" value="创建独立功能页面" onclick="Save();" />
    </fieldset>

    <fieldset>
        <legend id="">不带参数的功能</legend>
        <ol>
            <li> 执行一个独立的功能。</li>
            <li>应用场景</li>
            <li> 上班打卡。</li>
            <li> 清除测试数据。</li>
            <li> 备份数据库。</li>
            <li> 导入组织数据。</li>
            <li> 导入简历数据。</li>
        </ol>
    </fieldset>

    <fieldset>
        <legend id="">带参数的功能</legend>
        <ol>
            <li> 执行一个独立的功能，需要一定的参数.</li>
            <!--<li>应用场景</li>-->
            <!--<li> 上班打卡。</li>
            <li> 清除测试数据。</li>
            <li> 备份数据库。</li>-->
        </ol>
    </fieldset>
</body>
</html>
